const app = getApp();
import { getOptions } from '@/utils/index'
import { $map } from '@/apis/map'
import { $typicode } from '@/apis/typicode'
import { $shop } from '@/apis/shop'

Page({
  data: {
    options: {},
    userInfo: {},
    appInfo: {}
  },
  onLoad (options) {
    options = getOptions(options);
    this.setData({ options });
    app.appReadyCallback = ({ userInfo, appInfo }) => {
      this.setData({ userInfo, appInfo });
    };
  },
  onShow () {
    // this.getWxMap();
    // this.getTypicodeArticle();
    setTimeout(() => {
      this.getShopInfo();
    }, 0)
  },
  onReachBottom () {},
  onPullDownRefresh () {},
  // 腾讯地图
  getWxMap () {
    $map.getMapInfo({
      lat: '28.23529',
      lng: '112.93134'
    })
  },
  // 三方文章
  getTypicodeArticle () {
    $typicode.getArticleDetail(3)
  },
  // 本站配置
  async getShopInfo () {
    const result = await $shop.getShopInfo();
    console.log('$shop.getShopInfo() ==> ', result);
  }
});
